package com.zim.access.infrastructurre.protocol.ws;

import com.zim.access.infrastructurre.protocol.api.Protocol;
import com.zim.access.infrastructurre.protocol.api.Provider;
import lombok.var;

import java.net.URI;

/**
 * @author hanyue
 * @version 1.0
 * @date 2021/12/21 下午10:58
 */
public class WebsocketProtocol implements Protocol {

    @Override
    public Provider ref(URI url) {
        var protocol = url.getScheme();

        if ("ws".startsWith(protocol) || "wss".startsWith(protocol)) {
            return new WebsocketProvider();
        }

        return null;
    }
}
